//
//  YAYITagGroupNewCell.m
//  yayi-医生版
//
//  Created by Veer on 16/4/29.
//  Copyright © 2016年 Veer. All rights reserved.
//

#import "YAYITagGroupNewCell.h"

@implementation YAYITagGroupNewCell

+ (instancetype)cellWith:(UITableView *)tablevie
{
    static NSString *cellID = @"tagGroupNewCell";
    
    YAYITagGroupNewCell *cell = [tablevie dequeueReusableCellWithIdentifier:cellID];
    
    if (nil == cell) {
        cell = [[YAYITagGroupNewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setupSubView];
    }
    return self;
}

- (void)setupSubView
{
    // 头像
    UIImageView *iconView = [[UIImageView alloc] init];
    iconView.image = [UIImage imageNamed:@"newIcon"
                      ];
    
    [self.contentView addSubview:iconView];
    self.iconView = iconView;
    
    // 名字label
    UILabel *nameLbl = [[UILabel alloc] init];
    nameLbl.text = @"新建分组";
    nameLbl.font = [UIFont systemFontOfSize:15];
    nameLbl.textColor = YAYIColor(106, 177, 243);
    [self.contentView addSubview:nameLbl];
    self.nameLbl = nameLbl;
    
    // 底部线
    UIView *bottomLineView = [[UIView alloc] init];
    bottomLineView.backgroundColor = YAYIColor(0xe0, 0xe0, 0xe0);
    [self.contentView addSubview:bottomLineView];
    self.bottomLineView = bottomLineView;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.equalTo(@18);
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(@(15));
    }];
    
    [self.nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.iconView.mas_right).offset(10);
    }];
    
    [self.bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@0.5);
        make.width.equalTo(@(SCREEN_width));
        make.bottom.equalTo(self.contentView).offset(0);
        make.left.equalTo(self.contentView);
    }];
}


@end
